class SessionController < ApplicationController
    skip_before_filter :authentication_login

    def login
	       member=Member.find(1,:conditions => [ "truename = ?", params[:truename]])
         if(digest_enc(params[:password])==member.password) then
      		member.last_acc_date=date_time()
      		begin 
      		endmember.save!
      		rescue 
      		# else
      		# ensure
      		end
      		session[:uinfo]=member
          session[:uinfo][:login_state]=true
      		if(session[:to_url]) then
      			redirect_to session[:to_url]
      		else
      			redirect_to :action=>:default
      		end
        	else
        		flash[:notice]="login fail!请检查用户名和密码。"
        		redirect_to :actoin=>:default
        	end
    end

    def default
    end

    def logout
    	session[:uinfo]="";
    	redirect_to :action=>:default
    end
end
